@layout("/common/_container.html"){
<div class="ibox float-e-margins">
<style>
	input{
	 width:100%;
	 height:100%;
	}
	select{
	width:100%;
	height:100%;
	}
	</style>
    <div>
        <div class="form-horizontal" style='overflow:scroll;'>

            <div>
            <div>
            	<form id="collectBasicInformation">
            		<table border="1" cellpadding="4px" width="1000px">
            			<tr>
							<td>基本信息：</td>
							<td colspan="7"></td>
						</tr>
            			<tr>
							<td>收款单号:</td>
							<td><input id="collectId" name="collectId" type="text" value="${collectID}" readonly="readonly" style="background-color:#eee"/></td>
							<td>收款日期:</td>
							<td><input id="collectDate" name="collectDate" type="text" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})"/></td>
							<td>制单:</td>
							<td><input id="collectTradePerson" name="collectTradePerson"  value="${username}"readonly="readonly" type="text" style="background-color:#eee"/></td>
							<td>审核:</td>
							<td><input id="collectCheck" name="collectCheck" readonly="readonly" type="text" style="background-color:#eee"/></td>
						</tr>
            			<tr>
							<td>车号:</td>
							<td><input id="collectCarId" name="collectCarId" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>驾驶员：</td>
							<td><input id="collectCarDriver" name="collectCarDriver" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>联系电话：</td>
							<td><input id="collectCarDriverTell" name="collectCarDriverTell" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>手机：</td>
							<td><input id="collectCarDriverMobile" name="collectCarDriverMobile" type="text" readonly="readonly" style="background-color:#eee"/></td>
						</tr>
						<tr>
							<td>车次:</td>
							<td><input id="collectCarNumber" name="collectCarNumber" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>物流线路:</td>
							<td><input id="collectRouteId" name="collectRouteId" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>始发站：</td>
							<td><input id="collectRouteStart" name="collectRouteStart" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>到站：</td>
							<td><input id="collectRouteEnd" name="collectRouteEnd" type="text" readonly="readonly" style="background-color:#eee"/></td>
						</tr>
            			<tr>
							<td>运费:</td>
							<td><input id="collectSumGoodsFreight" name="collectSumGoodsFreight" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>信息费:</td>
							<td><input id="collectSumGoodsMessagefee" name="collectSumGoodsMessagefee" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>提货费：</td>
							<td><input id="collectSumGoodsPickupCharge" name="collectSumGoodsPickupCharge" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>中转站：</td>
							<td><input id="collectRouteTransferStation" name="collectRouteTransferStation" type="text" readonly="readonly" style="background-color:#eee"/></td>
						</tr>
            			<tr>
							<td>总费用:</td>
							<td><input id="collectSumFee" name="collectSumFee" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>本次收款:</td>
							<td><input id="collectThisMoney" name="collectThisMoney" type="text"/></td>
							<td>收款余额：</td>
							<td><input id="collectUncollectMoney" name="collectUncollectMoney" type="text" readonly="readonly" style="background-color:#eee"/></td>
							<td>收款方式：</td>
							<td><select id="collectType" name="collectType">
							  <option value ="现金" selected="selected">现金</option>
							  <option value ="转账">转账</option>
							</select></td>
						</tr>
						<tr>
							<td>备注</td>
							<td colspan="7"><input id="collectRemark" name="collectRemark" type="text"/></td>
						</tr>
            		</table>
            	</form>
            	</div>
            	<input type="hidden" id="money">
            	<div class="row">
						<div class="col-sm-4">
					              <#NameCon id="searchContract" name="搜索或选择合同号"/>
					     </div>
						</div>
           				 <div id="showContract" class="menuContent"
			                 style="display: none; position: absolute; z-index: 200;">
			                	<ul class="ztree tree-box" style="width: 300px !important;height:25px">
			                	<li>●请选择合同号：</li>
			                	</ul>
			                <ul id="show-Contract" class="ztree tree-box" style="width: 300px !important;">
			                </ul>
			            </div>
			            <!-- 装车信息的选择框 -->
			             <div id="showCarry" class="menuContent"
			                 style="display: none; position: absolute; z-index: 200;">
			                 <ul class="ztree tree-box" style="width: 300px !important;height:25px">
			                	<li>●请选择对应的装车单号：</li>
			                	</ul>
			                <ul id="show-Carry" class="ztree tree-box" style="width: 300px !important;">
			                </ul>
			            </div>
            	<div style='width:2550px;'>
            		<form id="collectCarryInformation">
            			<table border="1" cellpadding="4px" width="2500px" class="table1">
            				<tr>
								<td colspan="21">装车信息：</td>
							</tr>
							<tr>
								<td width="120px">装车单号</td>
								<td width="120px">合同号</td>
								<td width="70px">发货人</td>
								<td width="100px">发货人电话</td>
								<td width="250px">发货人地址</td>
								<td width="70px">收货人</td>
								<td width="100px">收货人电话</td>
								<td width="250px">收货人地址</td>
								<td width="145px">货物编号</td>
								<td width="250px">货物名称</td>
								<td width="250px">货物规格</td>
								<td width="100px">包装方式</td>
								<td width="115px">发货数量</td>
								<td width="90px">重量(KG)</td>
								<td width="90px">体积(m³)</td>
								<td width="70px">运费</td>
								<td width="70px">信息费</td>
								<td width="70px">提货费</td>
								<td width="120px">仓库</td>
								<td width="130px">备注</td>
							</tr>
            				<tr id="sumCopy">
								<td colspan="12">总计</td>
								<td id="carryCount"></td>
								<td id="sumWeight"></td>
								<td id="sumVolume"></td>
								<td id="sumFreight"></td>
								<td id="sumMessagefee"></td>
								<td id="sumPickupCharge"></td>
								<td colspan="2"></td>
							</tr>
            			</table>
            		</form>
            	</div>
            	</div>
            <div class="row btn-group-m-t">
                <div class="col-sm-10">
                    <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="CollectBasicInformationInfoDlg.addSubmit()"/>
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="CollectBasicInformationInfoDlg.close()"/>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/modular/system/collectBasicInformation/collectBasicInformation_info.js"></script>
<script>
	//初始化运费、信息费、提货费
function initCount(){
	//初始化发货数量
	var a = 0;
	$("input[name='collectThisQuantity']").each(function(){
		var count ;
		count=Number($(this).val());
        	a += count;
	});
	$("#carryCount").text(a);
	
	//初始化重量
	var b = 0;
	$("input[name='collectGoodsWeight']").each(function(){
		var count ;
		count=Number($(this).val());
        	b += count;
	});
	$("#sumWeight").text(b);
	//初始化体积
	var c = 0;
	$("input[name='collectGoodsVolume']").each(function(){
		var count ;
		count=Number($(this).val());
        	c += count;
	});
	$("#sumVolume").text(c);
	//初始化运费
	var d = 0;
	$("input[name='collectGoodsFreight']").each(function(){
		var count ;
		count=Number($(this).val());
        	d += count;
	});
	$("#sumFreight").text(d);
	$("#collectSumGoodsFreight").val(d);
	//信息费
	var e = 0;
	$("input[name='collectGoodsMessagefee']").each(function(){
		var count ;
		count=Number($(this).val());
        	e += count;
	});
	$("#sumMessagefee").text(e);
	$("#collectSumGoodsMessagefee").val(e);
	//提货费
	var f = 0;
	$("input[name='collectGoodsPickupCharge']").each(function(){
		var count ;
		count=Number($(this).val());
        	f += count;
	});
	$("#sumPickupCharge").text(f);
	$("#collectSumGoodsPickupCharge").val(f);
	
	//计算总费用
	var sumFee = Number($("#collectSumGoodsFreight").val())+Number($("#collectSumGoodsMessagefee").val())+Number($("#collectSumGoodsPickupCharge").val());
	$("#collectSumFee").val(sumFee);
}
	
//非负浮点数
var re = /^\d+(\.\d+)?$/ ;

function testRe(re, s){ // 参数说明 re 为正则表达式 s 为要判断的字符 
	return re.test(s) 
} 

//本次收款的动态计算
$("#collectThisMoney").keyup(function(){
	$("#collectUncollectMoney").val($("#money").val());
	var a = $("#collectUncollectMoney").val();
	var fee = Number($(this).val());
	if(testRe(re,fee)){
		var b = a-fee;
    	if(b<0){
    		alert("收款金额不得大于未收金额！");
    		$(this).val("");
    	}else{
    		$("#collectUncollectMoney").val(b);
    	}
	}else{
		alert("请输入有效数字!");
		$(this).val("");
	}
});
</script>
@}
